#ifndef NETWORK_H
#define NETWORK_H

#include <stdio.h>
#include <string>
#include "neuron.h"
#include "writer.h"

using namespace std;

class NeuralNetwork {

public:

	// vars 
	int layerCount;
	int neuronCount;
	int classCount;
	int attributeCount;
	int nrIterations;

	double *max;
	double *min;

	Neuron *hiddenLayer;
	Neuron *outputLayer;

	double error;
	double dataSet[150][7];
	double trainSet[150][7];
	double testSet[150][7];
	int **result;
	double *h;
	double *y;
	double *deltaY;
	double *deltaH;
	double learningRate;

	Writer writer;

	// functions
	NeuralNetwork(int layersCount,int neuronCount, int classesCount,int attributeCount,int nrIterations);
	void readInput(char *fileName);
	void splitData();
	void copyRowToTrainSet(int from,int to);
	void copyRowToTestSet(int from,int to);
	void normalize();
	void trainNetwork();
	void testNetwork();
	void computeOutput(int k);
	void computeErrors(int k);
	void initializeSets();
	void updateWeights(int k);
};
#endif